#!/usr/bin/perl
# diskswap.cgi in diskman

require './diskman-lib.pl';

&ReadParse();
$diskindex = $in{'disk'};
if ($diskindex =~ /(\d\/\d)/) {
    $nn = $1;
}

@disks = new_get_diskinfo(); 
if ($diskindex =~ /(\d+)\/(\d*)/) {
    $dnum = ($1 - 1) * 8 + $2 - 1;
}
$uid = $disks[$dnum]->{'status'};
if( $uid =~ /NORMAL/ ) {
    system("hptraidconf create spare disks=$nn RAID hpt");
}
else{
    system("hptraidconf delete $nn RAID hpt");

}

&redirect("index.cgi");


